package some.talk.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import some.list.dao.AllListDao;
import some.talk.dao.TalkDao;

@Controller
public class TalkStartController {

	@Autowired
	private TalkDao talkDao;
	
	@Autowired
	private AllListDao allListDao;
	
	@RequestMapping("/talkStart.do")
	public ModelAndView detail(HttpServletRequest request,
							   HttpSession session){
		
		String id = (String) session.getAttribute("id");
		String some_id = request.getParameter("some_id");
		
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("id", id);
		map.put("some_id", some_id);
		talkDao.setP_id(map);
		map.put("id", some_id);
		map.put("some_id", id);
		talkDao.setP_id(map);
		allListDao.setFListView(some_id);
		
		ModelAndView mav = new ModelAndView();
		mav.setViewName("someTalkReady");
				
		return mav;
	}
}
